package net.tngou.crawler.map;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import net.tngou.c4j.util.HttpUtil;

public class BaiduApi {

//	public static void main(String[] args) {
//		String url="http://api.map.baidu.com/geocoder/v2/";
//		Map<String, String> data = new HashMap<>();
//		data.put("ak", "1UNXvKFbGrWpGNGGlGIppIz6");
//		data.put("output", "json");
//		data.put("address", "涟水县永康药房");
////		data.put("address", "涟水县南集朱陈苗圃街9号");
//		String jsons = HttpUtil.getString(url, data);
//		JSONObject json = JSON.parseObject(jsons);
//		System.err.println(json);
//	}
	
	public static void main(String[] args) {
		String url="http://api.map.baidu.com/geoconv/v1/";
		Map<String, String> data = new HashMap<>();
		data.put("ak", "1UNXvKFbGrWpGNGGlGIppIz6");
		data.put("output", "json");
		data.put("coords", "114.21892734521,29.575429778924");
		data.put("from", "1");
		data.put("to", "1");
//		data.put("address", "涟水县南集朱陈苗圃街9号");
		String jsons = HttpUtil.getString(url, data);
		JSONObject json = JSON.parseObject(jsons);
		System.err.println(json);
	}
}
